package com.example.liwushuo.bar;

import com.example.liwushuo.R;
import com.example.liwushuo.SearchActivity;
import com.zbar.lib.CaptureActivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Toast;

public class HomeBar extends Fragment implements OnClickListener {

	private ImageView saomiao;
	private ImageView sousuo;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {

		View view = inflater.inflate(R.layout.bar_home, null);
		saomiao = (ImageView) view.findViewById(R.id.home_bar_saomiao);
		sousuo = (ImageView) view.findViewById(R.id.home_bar_sousuo);
		saomiao.setOnClickListener(this);
		sousuo.setOnClickListener(this);
		return view;
	}

	@Override
	public void onClick(View v) {

		switch (v.getId()) {
		case R.id.home_bar_saomiao:
			Toast.makeText(getActivity(), "扫描", 1).show();
			Intent intent = new Intent(getActivity(), CaptureActivity.class);
			startActivity(intent);
			break;
		case R.id.home_bar_sousuo:
			Intent sousuo = new Intent(getActivity(), SearchActivity.class);
			startActivity(sousuo);
			break;
		}

	}
}
